package com.hzeport.bgs22emduty.inbound.api;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hzeport.bgs22emduty.config.login.LoginCompoentService;
import com.hzeport.bgs22emduty.config.login.UserInfoDetailVO;
import com.hzeport.bgs22emduty.config.systemLog.OperLog;
import com.hzeport.bgs22emduty.dto.ScreenCheckQuestionsDTO;
import com.hzeport.bgs22emduty.dto.ScreenStandardControllerDTO;
import com.hzeport.bgs22emduty.dto.experience.ScreenDutyExperienceRemoveDTO;
import com.hzeport.bgs22emduty.entity.ScreenCheckQuestions;
import com.hzeport.bgs22emduty.entity.ScreenStandard;
import com.hzeport.bgs22emduty.service.ParamLeaderService;
import com.hzeport.bgs22emduty.service.ScreenCheckQuestionsService;
import com.hzeport.bgs22emduty.vo.ParamSmsTemplate.ParamSmsTemplateListVO;
import com.hzeport.bgs22emduty.vo.ScreenCheckQuestions.ScreenCheckQuestionsSaveVO;
import com.hzeport.bgs22emduty.vo.ScreenStandard.ScreenStandardsaveVO;
import com.hzeport.bgs22emduty.vo.base.PageVO;
import com.hzeport.bgs22emduty.common.base.BaseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@AllArgsConstructor
@RequestMapping("/screencheckquestions")
@Api(value = "screencheckquestions", tags = "抽查问题表")
@Slf4j
public class ScreenCheckQuestionsController {

    @Resource
    private ScreenCheckQuestionsService screenCheckQuestionsService;

    @Resource
    private LoginCompoentService loginCompoentService;

    @ApiOperation(value = "列表")
    @RequestMapping(value = "list",method = RequestMethod.POST)
    public  BaseResult<Page<ScreenCheckQuestions>> list(@RequestBody ScreenCheckQuestionsDTO dto) {
        UserInfoDetailVO userInfoDetailVO=loginCompoentService.getUserInfo();
        return  screenCheckQuestionsService.list(dto,userInfoDetailVO);
    }


    @ApiOperation(value = "删除")
    @RequestMapping(value = "delete",method = RequestMethod.POST)
    @OperLog( systemName = "CCWT", description = "CCSC")
    public BaseResult removeById(@RequestBody ScreenDutyExperienceRemoveDTO screenDutyExperienceRemoveDTO) {
        UserInfoDetailVO userInfoDetailVO=loginCompoentService.getUserInfo();
        return screenCheckQuestionsService.delete(screenDutyExperienceRemoveDTO.getId() ,userInfoDetailVO);
    }

    @ApiOperation(value = "保存")
    @RequestMapping(value = "save",method = RequestMethod.POST)
    @OperLog( systemName = "CCWT", description = "CCBC")
    public BaseResult save(@RequestBody ScreenCheckQuestionsSaveVO screenCheckQuestionsSaveVO){
        UserInfoDetailVO userInfoDetailVO=loginCompoentService.getUserInfo();
        return  screenCheckQuestionsService.saveData(screenCheckQuestionsSaveVO,userInfoDetailVO);
    }

    @ApiOperation(value = "获取详情")
    @RequestMapping(value = "detail",method = RequestMethod.GET)
    public BaseResult<ScreenCheckQuestions> detail(@RequestParam("id") String id)  {
        return screenCheckQuestionsService.detail(id);
    }
}
